package com.zzxx.wechat.dao;

import com.baomidou.mybatisplus.extension.service.IService;
import com.zzxx.wechat.entity.UserAttention;
import com.zzxx.wechat.mapper.UserAttentionMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户关注表 服务实现类
 * </p>
 *
 * @author zzxx
 * @since 2024-01-19
 */
@Service
public class UserAttentionDao extends ServiceImpl<UserAttentionMapper, UserAttention> implements IService<UserAttention> {


    public UserAttention queryByOpenIdAndSpuId(String openId, String spkId) {
        return lambdaQuery()
                .eq(UserAttention::getSpuId, spkId)
                .eq(UserAttention::getOpenId, openId)
                .one();
    }

    public List<UserAttention> queryBySpuId(String spkId) {
        return lambdaQuery()
                .eq(UserAttention::getSpuId, spkId)
                .list();
    }


}
